package com.example.compositepattern.entity;

/**
 * @author ash
 * @description
 * @create 2023/2/20  22:13:46
 * @className Leaf
 * @verson 1.0.0
 */
public class Leaf extends Component{

    public Leaf(String name) {
        super(name);
    }

    @Override
    public void add(Component component) {

    }

    @Override
    public void remove(Component component) {

    }

    @Override
    public void display(int depth) {
        StringBuilder s = new StringBuilder("-");
        for (int i = 0; i < depth; i++) {
            s.append("-");
        }
        System.out.println(s + name);
    }
}
